home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -serious- / programming / basic / mildred / lha / landtest4.lha / LandTest4.ascii < prev    next >
Text File  |  1999-05-11  |  7KB  |  277 lines

  1. WBStartup
  2. #Width=320
  3. #Height=240
  4. MCPU Processor
  5. Mc2pCPUmode Processor
  6.  
  7. Pic$="5Ms2.IFF"
  8. Land$="Land17.iff"
  9. sky$="sky10.iff"
  10. #Objects=25  ;55;150;280;400
  11. #ObjWidth=128  ;64;32;16;8
  12. #ObjHeight=64  ;64;32;16;8
  13. #StarsPerSpeed=15
  14.  
  15. MReserveShapes 500
  16. InitBank 0,2880*60,$10002
  17. CludgeBitMap 0,2880,60,8,Bank(0)
  18. InitPalette 0,256
  19. LoadBitMap 0,Land$,0
  20. MReserveBitmaps 3
  21. MBitmap 0,2880,60
  22. MPlanar16ToBitmap 0,Bank(0)
  23. MCludgeShape 0,16,27,MBitmapPtr(1120,0)
  24. MBitmap 2,#Width,150
  25. MBitmap 1,#Width+128,#Height+128
  26. InitBank 0,#Width*#Height,$10002
  27. CludgeBitMap 0,#Width,#Height,8,Bank(0)
  28. Screen 0,0,0,#Width,#Height,8,0,"",0,0,0
  29. Window 0,0,0,#Width,#Height,$100,"back",0,0
  30. InitShape 0,16,1,2
  31. WPointer 0
  32. Menus Off
  33. InitPalette 1,256
  34. LoadBitMap 0,Pic$,1
  35. For c=64+64+64 To 255
  36.   CopyColour 0,1,c,c
  37. Next c
  38. MReservec2pWindows 1
  39. Mc2pWindow 0,#Width,#Height,#Width+128,#Width,#Height
  40. s=1
  41. For y=0 To 63 Step #ObjHeight
  42.   For x=0 To 127 Step #ObjWidth
  43.     If MShape(s,#ObjWidth,#ObjHeight)=0 Then End
  44.     For yy=y To y+#ObjHeight-1
  45.       For xx=x To x+#ObjWidth-1
  46.         MPlotShape xx MOD #ObjWidth, yy MOD #ObjHeight, Point(xx,yy)
  47.       Next xx
  48.     Next yy
  49.     MMakeCookie s
  50.     s+1
  51.   Next x
  52. Next y
  53. Cls 0
  54. LoadBitMap 0,sky$,0
  55. For c=0 To 63
  56.   CopyColour 0,1,c,c
  57. Next c
  58. MPlanar16ToBitmap 2,Bank(0),#Width,150,#Width,#Height
  59. NumberOfShapes.w=s-1
  60. ShowPalette 1
  61.  
  62. NEWTYPE.xy
  63.   x.w
  64.   y.w
  65. End NEWTYPE
  66. Dim pos.xy(#Objects)
  67. Dim pos2.xy(#Objects)
  68. Dim direction.xy(#Objects)
  69. For obj=1 To #Objects
  70.   pos(obj)\x=Rnd(2220-36)+16
  71.   pos(obj)\y=Rnd(#Height-100-32)+16+13
  72.   Repeat
  73.     direction(obj)\x=Rnd(8)-4
  74.   Until direction(obj)\x<>0
  75.   direction(obj)\y=Rnd(6)-3
  76. Next obj
  77.  
  78. NEWTYPE.xyq
  79.   x.q
  80.   y.q
  81. End NEWTYPE
  82. Dim star1.xyq(#StarsPerSpeed)
  83. Dim star2.xyq(#StarsPerSpeed)
  84. Dim star3.xyq(#StarsPerSpeed)
  85. Dim star4.xyq(#StarsPerSpeed)
  86. Dim star5.xyq(#StarsPerSpeed)
  87. For s=1 To #StarsPerSpeed
  88.   star1(s)\x=Rnd(319)
  89.   star1(s)\y=Rnd(120)
  90.   star2(s)\x=Rnd(319)
  91.   star2(s)\y=Rnd(100)
  92.   star3(s)\x=Rnd(319)
  93.   star3(s)\y=Rnd(80)
  94.   star4(s)\x=Rnd(319)
  95.   star4(s)\y=Rnd(60)
  96.   star5(s)\x=Rnd(319)
  97.   star5(s)\y=Rnd(40)
  98. Next s
  99.  
  100. speedsetting.q=1 ; Global speed multiplier
  101. xpos.q=0
  102. xaccelerate.q=1*speedsetting
  103. xmomentum.q=0
  104. xairresistance.q=0;.1*speedsetting
  105. xmaxspeed.q=16*speedsetting
  106. ypos.q=(#Height-69)/2
  107. yaccelerate.q=1;*speedsetting
  108. ymomentum.q=0
  109. ymaxspeed.q=8*speedsetting
  110. ytopdampen.q=1.9
  111. ybottomdampen.q=1.65
  112. ygravity.q=0.15;*speedsetting
  113.  
  114. NEWTYPE.OffsetList
  115.   LineWidth.w
  116.   X1Offset.w
  117.   X2Offset.w
  118.   ModuloOffset.w
  119. End NEWTYPE
  120. Dim rows.OffsetList(47)
  121. Dim rowsq.q(47)
  122.  
  123. cnt.l=0
  124. MParticleFormat 0
  125. MBitmapOrigin 1,64,64
  126. MBitmapWrap 1,On
  127. intcnt=0
  128. SetInt 5
  129.   intcnt+1
  130. End SetInt
  131. ResetTimer
  132. While Joyb(1)=0
  133.  
  134.   jh=JHoriz(1)
  135.   jv=JVert(1)
  136.  
  137.   xmomentum+(xaccelerate*jh)
  138.   ymomentum+(yaccelerate*jv)
  139.  
  140.   ymomentum+ygravity
  141.   If xmomentum>0
  142.     xmomentum-xairresistance
  143.     If xmomentum<0 Then xmomentum=0
  144.   Else
  145.     xmomentum+xairresistance
  146.     If xmomentum>0 Then xmomentum=0
  147.   EndIf
  148.  
  149.   If xmomentum>xmaxspeed Then xmomentum=xmaxspeed
  150.   If xmomentum<-xmaxspeed Then xmomentum=-xmaxspeed
  151.   If ymomentum>ymaxspeed Then ymomentum=ymaxspeed
  152.   If ymomentum<-ymaxspeed Then ymomentum=-ymaxspeed
  153.  
  154.   xpos+xmomentum
  155.   ypos+ymomentum
  156.  
  157.   If ypos<0
  158.     ymomentum=-ymomentum/ytopdampen
  159.     ypos=0
  160.   EndIf
  161.   If ypos>#Height-40-26
  162.     ymomentum=-ymomentum/ybottomdampen
  163.     ypos=#Height-40-26
  164.   EndIf
  165.  
  166.   If xpos<0 Then xpos+2240
  167.   If xpos>=2240 Then xpos-2240
  168.  
  169.   cnt+1
  170.  
  171. ;  MBitmapClip 1,0,0,#Width,#Height-60-14-26,On
  172. ;  MCls 0
  173.   MBlockScroll 0,0,#Width,#Height-60-32,0,0,2
  174.   c=193
  175.   For yy=#Height-61-26-14 To #Height-61-26
  176.     MBoxF 0,yy,319,yy,c
  177.     c+1
  178.   Next yy
  179.  
  180.   xx.q=xpos/7
  181.   For b=1 To 8
  182.     MBoxF 320-xx,#Height-62-26,320-xx+3,#Height-61-26,220
  183.     xx+40
  184.     If xx>319 Then xx-320
  185.   Next b
  186.  
  187.   MAddXYToParticlesQ &star1(1)\x,#StarsPerSpeed,-(xmomentum/60),0
  188.   MAddXYToParticlesQ &star2(1)\x,#StarsPerSpeed,-(xmomentum/50),0
  189.   MAddXYToParticlesQ &star3(1)\x,#StarsPerSpeed,-(xmomentum/40),0
  190.   MAddXYToParticlesQ &star4(1)\x,#StarsPerSpeed,-(xmomentum/30),0
  191.   MAddXYToParticlesQ &star5(1)\x,#StarsPerSpeed,-(xmomentum/20),0
  192.   MParticleFormat -1
  193.   MBitmapClip 1,On
  194.   MWrapXParticles &star1(1)\x,#StarsPerSpeed
  195.   MWrapXParticles &star2(1)\x,#StarsPerSpeed
  196.   MWrapXParticles &star3(1)\x,#StarsPerSpeed
  197.   MWrapXParticles &star4(1)\x,#StarsPerSpeed
  198.   MWrapXParticles &star5(1)\x,#StarsPerSpeed
  199.   MBitmapClip 1,Off
  200.   MPlotParticles &star1(1)\x,#StarsPerSpeed,192+14-Rnd(12)
  201.   MPlotParticles &star2(1)\x,#StarsPerSpeed,192+20-Rnd(12)
  202.   MPlotParticles &star3(1)\x,#StarsPerSpeed,192+26-Rnd(12)
  203.   MPlotParticles &star4(1)\x,#StarsPerSpeed,192+32-Rnd(12)
  204.   MPlotParticles &star5(1)\x,#StarsPerSpeed,192+38-Rnd(12)
  205.   MParticleFormat 0
  206.  
  207.   MScroll 160+xpos,47,#Width,13,0,#Height-13-26,0
  208.   mult.q=1.0
  209.   width.q=2240
  210.   widthadd.q=(2240-320)/47
  211.   For yy=46 To 0 Step -1
  212.     rowsq(yy)=1280-(width LSR 1)+(xpos*mult) ; 1280=1120+320-160
  213.     width-widthadd
  214.     mult-0.01825
  215.     ;mult=width/2240
  216.   Next yy
  217.   rows(0)\LineWidth=320,Int(rowsq(0)),0,0
  218.   For yy=1 To 46
  219.     rows(yy)\LineWidth=320,Int(rowsq(yy))-Int(rowsq(yy-1)),0,0
  220.   Next yy
  221.   MScroll 0,0,320,47,0,#Height-60-26,0,&rows(0)\LineWidth
  222.  
  223.   MBitmapClip 1,20,#Height-26-6,#Width-40,26,On
  224.   MCls 192
  225.   MBitmapClip 1,Off
  226.   MBoxF 139,#Height-26-6,180,#Height-1-6,205
  227.   MBox 138,#Height-26-6,180,#Height-1-6,210
  228.   MScroll 160+xpos+20,47,320-40,6,20,#Height-6,0
  229.  
  230.   MAddToParticles &pos(1)\x,#Objects,&direction(1)\x
  231.   For obj=1 To #Objects
  232.     If pos(obj)\x<0 Then pos(obj)\x+2240
  233.     If pos(obj)\x>=2240 Then pos(obj)\x-2240
  234.     If pos(obj)\y<8 OR pos(obj)\y>#Height-16-#ObjHeight-26 Then direction(obj)\y=-direction(obj)\y
  235.   Next obj
  236.   For obj=1 To #Objects
  237.     pos2(obj)\x=pos(obj)\x LSR 3
  238.     pos2(obj)\y=#Height-26-6+(pos(obj)\y LSR 3)
  239.   Next obj
  240.   MAddXYToParticles &pos2(1)\x,#Objects,320-(xpos LSR 3)-180,0
  241.   MBitmapClip 1,20,0,#Width-40,#Height,On
  242.   MWrapXParticles &pos2(1)\x,#Objects
  243.   MBitmapClip 1,Off
  244. ;  MPlotParticles &pos2(1)\x,#Objects,255
  245.   ww=(#ObjWidth LSR 3)-1
  246.   hh=(#ObjHeight LSR 3)-1
  247. ;  MDrawingMode MAddMode
  248.   For p=1 To #Objects
  249. ;    MBoxF pos2(p)\x,pos2(p)\y,pos2(p)\x+ww,pos2(p)\y+hh,15
  250.     MZoomShapeToBitmap 3,3,7,7,pos2(p)\x,pos2(p)\y,ww,hh,False,(p MOD NumberOfShapes)+1
  251.   Next p
  252. ;  MDrawingMode MColourMode
  253.   MScroll 160+xpos,47,20,13,0,#Height-26,0
  254.   MScroll 160+xpos,47,20,13,0,#Height-13,0
  255.   MScroll 160+xpos+300,47,20,13,300,#Height-26,0
  256.   MScroll 160+xpos+300,47,20,13,300,#Height-13,0
  257.   MPlot 160,#Height-25-6+(ypos LSR 3),40
  258.   MPlot 160,#Height-24-6+(ypos LSR 3),40
  259.   For obj=1 To #Objects
  260.     If pos(obj)\x>xpos-#ObjWidth AND pos(obj)\x<xpos+#Width;-#ObjWidth+#ObjWidth
  261.       MBlit (obj MOD NumberOfShapes)+1,pos(obj)\x-xpos,pos(obj)\y
  262.     EndIf
  263.   Next obj
  264.  
  265.   MBlit 0,152,ypos
  266.   Mc2p Bank(0)
  267. ;  If intcnt<=2 Then VWait Else intcnt=0 ; only wait for 25fps if faster
  268.  
  269. Wend
  270. t=Timer
  271. a.q=50.0/(t/cnt)
  272. NPrint a
  273. VWait 30
  274. Repeat:Until Joyb(0)<>0 OR Joyb(1)<>0
  275. End
  276.  
  277.